<?php

class ViewTemplate extends ViewSystem {

	public $title = "";
    public $content = null;
  
    public function __construct($file){
    	return parent::__construct("_template/" . $file);
    }
    
    public function hasValidContent() {
    	return ($this->content != null);
    }
    
    private function setTitle($title) {
    	$this->values['title'] = ( $title != "" || !isset($this->values['title']) ) ? $title : $this->values['title'] ;
    }
    
    public function output($haveCleanRest = false) {
		$this->setTitle( $this->title );
		if( $this->content != null ){
			if (get_class($this->content) == "View")
				$this->setTitle( $this->content->title );
			$this->set("content", $this->content->output());
		}
    	return parent::output($haveCleanRest);
    }
}

?>